<!DOCTYPE html>
<html>
<#assign contextPath = request.contextPath/>
	<head>
		<meta charset="UTF-8">
		<title>分类查看</title>
		<link href="${contextPath}/css/bootstrap.min.css" rel="stylesheet">
	</head>

	<body>
		<#include "/common/nav.html">
		<div class="container-fluid">
			<div class="row">
				<#include "/common/left_user.html">
				<div class="col-sm-9">
					<ol class="breadcrumb">
					  <li><a href="#">主页</a></li>
					  <li class="active">分类查询</li>
					</ol>
					<#if !Request.p?? && !Parameters.vtid??>
					<div class="row">
						<#list listvt as vt>
						<div class="col-xs-6 col-md-3" style="margin-top: 20px;">
							<button class="btn btn-primary" type="button" style="width: 150px; height: 120px; font-size: 25px;" onclick="listbyvt(${vt.vtId})">
  							${vt.vtName} <span class="badge">${vt.votes.size()}</span>
							</button>
						</div>
						</#list>
					</div>
					<#else>
						<div class="table-responsive">
							<table class="table table-striped">
								<thead>
									<tr>
										<th>序号</th>
										<th>分类</th>
										<th>投票名</th>
										<th>参与人数</th>
										<th>投票</th>
									</tr>
								</thead>
								<tbody>
									<#list p.list as v>
									<tr>
										<td>${p.startNum+v_index+1}</td>
										<td>${v.voteType.vtName!}</td>
										<td>${v.vtitle!}</td>
										<td>${v.vturnout!}</td>
										<td>
												<button type="button" class="btn btn-default btn-sm"
													data-toggle="modal" data-target="#exampleModal"
													data-whatever="${v.vid}">
													<span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span>
													投票
												</button>
										</td>
									</tr>
									</#list>
								</tbody>
							</table>
							<nav aria-label="Page navigation"  style="text-align: center">
								<ul class="pagination" >
									<li <#if !p.hasPrev>class="disabled"</#if>><a   <#if p.hasPrev> href="getAllByType.action?vtid=${vtid}&p.pageNum=${p.pageNum-1}"</#if> aria-label="Previous"> <span
											aria-hidden="true">上一页</span>
									</a></li>
									<#list 1..p.pageSum as i>    
									  <li <#if p.pageNum == i>class="active"</#if>><a   href="getAllByType.action?vtid=${vtid}&p.pageNum=${i}">${i}</a></li>
									</#list>
									<li <#if !p.hasNext>class="disabled"</#if>><a <#if p.hasNext> href="getAllByType.action?vtid=${vtid}&p.pageNum=${p.pageNum+1}"</#if> aria-label="Next"> <span
											aria-hidden="true">下一页</span>
									</a></li>
								</ul>
							</nav>
						</div>
					</#if>
				</div>
			</div>
		</div>
		<script type="text/javascript">
			function listbyvt(vtid){
				location.href="getAllByType.action?vtid="+vtid;
			}
		</script>
	</body>

</html>